<!DOCTYPE html>
<html>
<head>
	<!-- Google Tag Manager -->
	<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
	new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
	j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
	'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
	})(window,document,'script','dataLayer','GTM-W8KNPT4');</script>
	<!-- End Google Tag Manager -->
	<meta charset="utf-8">
    <meta name="viewport" content="width=device-width,inital-scale=1,maximum-scale=1,minimum-scale=1,user-scalable=no,minimal-ui">
    <meta name="apple-mobile-web-app-capable" content="yes">
	<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
	<meta name="format-detection" content="telephone=no">
    <title>博猫体育</title>
    <link rel="stylesheet" href="css/app.min.css?ver=1.0.000">
    <link rel="stylesheet" href="css/iconfont.css?ver=1.0.000">
    <script src="js/template7.min.js"></script>
    <script src="http://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js" type="text/javascript"></script>
    <script src="js/templateHelper.js"></script>
    <script src="js/order.min.js"></script>
    <script src="js/pageLib.js"></script>
</head>
<body>
<div class="header">
	<div class="nav">
		<div class="title">我的订单</div>
		<a href="me.html" class="left-btn"><i class="iconfont icon-xitongfanhui icon-middle"></i></a>
		<a class="right-btn login-bar" href="login.html">登录 / 注册</a>
		<div class="right-btn user-info-bar" style="display:none;">
			<div class="login flexer">
				<div class="balance">
					<div>余额</div>
					<div>￥888.88</div>
				</div>
				<div class="deposit"><a href="deposit.html">充值</a></div>
			</div>
		</div>
	</div>
	<ul class="navgation flexer">
		<li><a id="all-tap" href="?status=all">全部</a></li>
		<li><a id="toopen-tap" href="?status=toopen">待开奖</a></li>
		<li><a id="already-tap" href="?status=already">已中奖</a></li>
	</ul>
</div>
<div class="table-content" style="padding-top:90px;padding-bottom:120px;">
	<!-- <a href="javascript:alert('教程还没写好...');" class="tips">
		<span>小提示</span>
		<p>串关对冲套利怎么玩？</p>
		<i class="iconfont icon-xiayibu"></i>
	</a> -->
	<div class="preload-indicator">
		<span class="preloader"></span>
		<div>正在加载对阵列表...</div>
	</div>
	<!-- <ul class="list orders-list">
		<li class="order-cell">
			<a href="order-details.html" class="order flexer">
				<div class="orderdate">
					<div>11-26</div>
					<div>17:07</div>
				</div>
				<div class="detail">
					<div class="ordertype">竞彩足球</div>
					<div class="price">2.00元</div>
				</div>
				<div class="status flex-to-right">
					<div class="won">赢￥888.88</div>
				</div>
			</a>
		</li>
		<li class="order-cell">
			<a href="order-details.html" class="order flexer">
				<div class="orderdate">
					<div>11-26</div>
					<div>17:07</div>
				</div>
				<div class="detail">
					<div class="ordertype">竞彩足球</div>
					<div class="price">2.00元</div>
				</div>
				<div class="status flex-to-right">
					<div class="active">待开奖</div>
				</div>
			</a>
		</li>
		<li class="order-cell">
			<a href="order-details.html" class="order flexer">
				<div class="orderdate">
					<div>11-26</div>
					<div>17:07</div>
				</div>
				<div class="detail">
					<div class="ordertype">竞彩足球</div>
					<div class="price">2.00元</div>
				</div>
				<div class="status flex-to-right">
					<div class="pending">待出票</div>
				</div>
			</a>
		</li>
	</ul> -->
</div>

</body>
<script id="order-cell-tpl" type="text/Template7">
<ul class="list orders-list">
{{#each data}}
<li class="order-cell">
	<a href="order-details.html?order_no={{order_no}}" class="order flexer">
		<div class="orderdate">
			<div>{{create_date}}</div>
			<div>{{create_time}}</div>
		</div>
		<div class="detail">
			<div class="ordertype">{{lotteryName lottery_id}}</div>
			<div class="price">{{amount}}元</div>
		</div>
		<div class="status flex-to-right">
			<div class="{{orderStatusClass status}}">{{orderStatus status}}{{prizeFormat aftertaxprize}}</div>
		</div>
	</a>
</li>
{{/each}}
</ul>
</script>
<script type="text/javascript">
$(document).ready(function(){
	pageLib.loadUserInfo();
	var status=pageLib.getQueryArgs(window.location.href).status;
	if(!status)status='all';
	// console.log(status);
	$('ul.navgation > li > a').removeClass('active');
	switch(status){
		case 'toopen':
			$('.navgation #toopen-tap').addClass('active');
			break;
		case 'already':
			$('.navgation #already-tap').addClass('active');
			break;
		default:
			$('.navgation #all-tap').addClass('active');
	}
	pageLib.api({
		action: '/v1/order/order-list',
		type: 'get',
		data:{
			status: status
		},
		success: function(resp){
			console.log(resp);
			if(resp.data.length>0){
				var listHtml=TplHelper.renderTplById('order-cell-tpl',resp);
				$('.table-content').html(listHtml);
			}
			else{
				$('.table-content').html('<center class="empty-placeholder">没有订单记录~</center>');
			}

		},
		error: function(XMLHttpRequest,err,exeption){
			if(XMLHttpRequest.status==401){
				window.location.href="login.html";
			}
		}
	});
});

</script>
</html>